package leecode.q0104.aaa;

import java.util.ArrayList;
import java.util.List;

public class Solution {
    public boolean canPermutePalindrome(String s) {
        if (s == null || s.length() <= 1) {
            return true;
        }
        List<String> list = new ArrayList<>();
        char[] chars = s.toCharArray();
        for (char aChar : chars) {
            if (list.contains(String.valueOf(aChar))) {
                list.remove(String.valueOf(aChar));
            } else {
                list.add(String.valueOf(aChar));
            }
        }
        return list.size() <= 1;
    }
}
